home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00025_Glass on bartop Behavior.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  8.7 KB  |  364 lines

  1. property pSpr, pOrigLoc, pGlassType, pOrigMember, pGlassMask, pGlassCheat, pGlassIce, pContents, pContentString, pCapacity, pOverItem, pMyBarSlot, pOldIceAmount, pOldContents, pOldGlassType, pOldMember, penisBeer
  2. global debug, gWellSprite, gBarTopManager
  3.  
  4. on beginSprite me
  5.   global gLastVessel
  6.   pSpr = sprite(me.spriteNum)
  7.   if not debug then
  8.     pSpr.visible = 0
  9.   end if
  10.   pGlassIce = sprite(me.spriteNum - 1)
  11.   pGlassMask = sprite(me.spriteNum + 1)
  12.   pGlassCheat = sprite(me.spriteNum + 2)
  13.   pOverItem = 0
  14.   penisBeer = member("BEE_twist")
  15.   mEmptyGlass(me)
  16.   pMyBarSlot = glassSpriteToBarSlot(me.spriteNum)
  17. end
  18.  
  19. on mEmptyGlass me
  20.   global gLastVessel
  21.   if gLastVessel = pMyBarSlot then
  22.     setPourClockText(" Drink Contents Shown Here")
  23.     gLastVessel = 0
  24.   end if
  25.   pContents = [:]
  26.   pContentString = EMPTY
  27.   pSpr.member = pOrigMember
  28.   sendSprite(pGlassIce, #mEmptyGlass)
  29.   sendSprite(pGlassMask, #mEmptyGlass)
  30.   sendSprite(pGlassCheat, #mEmptyGlass)
  31.   replaceWellItem()
  32. end
  33.  
  34. on mUpdateContents me, glassType, newContents, newGarnish, oldIceAmount
  35.   if not voidp(newContents) then
  36.     pContents = newContents
  37.   end if
  38.   if not voidp(newGarnish) then
  39.     deleteProp(pContents, #olive)
  40.     deleteProp(pContents, #lemonWedge)
  41.     deleteProp(pContents, #orangeWedge)
  42.     deleteProp(pContents, #limeWedge)
  43.     deleteProp(pContents, #cherry)
  44.     deleteProp(pContents, #lemontwist)
  45.     deleteProp(pContents, #limetwist)
  46.     if newGarnish <> #noGarnish then
  47.       pContents[newGarnish] = 1
  48.     end if
  49.   end if
  50.   pContentString = VOID
  51.   mupdateDisplay(me, glassType)
  52.   if glassType <> #beer then
  53.     sendSprite(pGlassMask, #mUpdateLiquidLevel)
  54.     sendSprite(pGlassIce, #mUpdateIceLevel, oldIceAmount)
  55.     showGlassAccessories(me)
  56.   end if
  57. end
  58.  
  59. on mupdateDisplay me, glassType
  60.   global gLastVessel
  61.   gLastVessel = pMyBarSlot
  62.   pContentString = buildVesselContentList(pSpr, pGlassType, " The Glass is Empty")
  63.   showDrinkContents(glassType, pContentString, VOID)
  64. end
  65.  
  66. on mPlaceDrink me, glassMember, newLoc, glassType, keepOldMaskAndIce, priorContents
  67.   global gGlassware
  68.   pSpr.member = glassMember
  69.   pSpr.loc = newLoc
  70.   pGlassType = glassType
  71.   if pGlassType = #beer then
  72.     mEmptyGlass(me)
  73.     hideGlassAccessories(me)
  74.     pContents = [#beer: 1]
  75.     pCapacity = 0
  76.     pSpr.visible = 1
  77.     pOrigMember = glassMember
  78.     pSpr.member = pOrigMember
  79.   else
  80.     if not keepOldMaskAndIce then
  81.       if not voidp(priorContents) then
  82.         pContents = priorContents
  83.       else
  84.         pOrigMember = glassMember
  85.         mEmptyGlass(me)
  86.       end if
  87.       pSpr.visible = 1
  88.       pCapacity = getCapacity(pGlassType)
  89.       sendSprite(pGlassIce, #mPlaceDrink, glassMember, newLoc)
  90.       sendSprite(pGlassMask, #mPlaceDrink, getMaskMember(me), newLoc)
  91.       sendSprite(pGlassCheat, #mPlaceDrink, glassMember, newLoc)
  92.     end if
  93.   end if
  94. end
  95.  
  96. on getMaskMember me
  97.   return member(glassPrefix(pGlassType) && "mask" & pMyBarSlot)
  98. end
  99.  
  100. on mRemoveDrink me
  101.   pSpr.locH = -1000
  102.   mEmptyGlass(me)
  103.   sendSprite(pGlassIce, #mRemoveDrink)
  104.   sendSprite(pGlassMask, #mRemoveDrink)
  105.   sendSprite(pGlassCheat, #mRemoveDrink)
  106. end
  107.  
  108. on mReduceLiquid me, drinkAll
  109.   maxCount = count(pContents)
  110.   repeat with X = maxCount down to 1
  111.     thisIng = getPropAt(pContents, X)
  112.     cat = getCategory(thisIng)
  113.     if getOne([2, 4, 5, 6, 7, 8, 16], cat) then
  114.       if drinkAll then
  115.         deleteAt(pContents, X)
  116.         next repeat
  117.       end if
  118.       pContents[X] = pContents[X] * 0.66000000000000003
  119.     end if
  120.   end repeat
  121. end
  122.  
  123. on mHideDrink me
  124.   pSpr.visible = 0
  125.   hideGlassAccessories(me)
  126. end
  127.  
  128. on hideGlassAccessories me
  129.   sendSprite(pGlassIce, #mHideDrink)
  130.   sendSprite(pGlassMask, #mHideDrink)
  131.   sendSprite(pGlassCheat, #mHideDrink)
  132. end
  133.  
  134. on showGlassAccessories me
  135.   sendSprite(pGlassIce, #mShowDrink)
  136.   sendSprite(pGlassMask, #mShowDrink)
  137.   sendSprite(pGlassCheat, #mShowDrink)
  138. end
  139.  
  140. on mShowDrink me
  141.   pSpr.visible = 1
  142.   showGlassAccessories(me)
  143. end
  144.  
  145. on endSprite me
  146.   pSpr.visible = 1
  147. end
  148.  
  149. on mOverItem me, bottleSprite, spoutLoc, ingredient
  150.   if (pGlassType = #beer) and not isGarnish(ingredient) then
  151.     return 0
  152.   else
  153.     if pGlassType = #cocktail then
  154.       return pourIntersection(pGlassMask, bottleSprite, spoutLoc)
  155.     else
  156.       return pourIntersection(pSpr, bottleSprite, spoutLoc)
  157.     end if
  158.   end if
  159. end
  160.  
  161. on mouseLeave me
  162.   if draggingIngredient() then
  163.     hideToolTip()
  164.     hideDrinkContents()
  165.   end if
  166.   pOverItem = 0
  167. end
  168.  
  169. on mouseEnter me
  170.   global gSpoonSprite, gToolTip
  171.   if pSpr.visible then
  172.     pOverItem = 1
  173.     if pSpr.member = penisBeer then
  174.       sendSprite(gToolTip, #mShowToolTip, pSpr, "Custom Molded Dildo", pSpr.loc)
  175.     else
  176.       showToolTip(pSpr, pGlassType)
  177.     end if
  178.     if draggingBarTopGlass() then
  179.       exit
  180.     end if
  181.     if pSpr.member = penisBeer then
  182.       refreshPourMeter("Dildo", VOID)
  183.     else
  184.       showToolTip(pSpr, pGlassType)
  185.     end if
  186.     if the mouseDown and (the clickOn <> gSpoonSprite.spriteNum) then
  187.       mouseDown(me)
  188.     end if
  189.   end if
  190. end
  191.  
  192. on mGetReceiveSound me
  193.   if mHasIce(me) then
  194.     soundName = "water_into_mglass_wice"
  195.   else
  196.     soundName = "water_into_mglass"
  197.   end if
  198.   return soundName
  199. end
  200.  
  201. on isHoldingJuiceAndMixers
  202.   return calcWimpyContents(pContents)
  203. end
  204.  
  205. on mIsHoldingVolume me
  206.   return calcContents(pContents)
  207. end
  208.  
  209. on mIsHoldingLiquor me
  210.   return calcLiquorContents(pContents)
  211. end
  212.  
  213. on mIsHoldingLiquid me
  214.   return calcLiquidContents(pContents)
  215. end
  216.  
  217. on mIsHoldingPourable me
  218.   return calcPourableContents(pContents)
  219. end
  220.  
  221. on mIsEmpty me
  222.   return calcEmpty(pContents)
  223. end
  224.  
  225. on mHasIce me
  226.   if voidp(pContents[#ice]) then
  227.     return 0
  228.   else
  229.     return integer(pContents[#ice])
  230.   end if
  231. end
  232.  
  233. on mouseDown me
  234.   global gRecipeWindow
  235.   makePatronActive(pMyBarSlot)
  236.   if isVisible(gRecipeWindow) then
  237.     tell gRecipeWindow
  238.       updateStage()
  239.     end tell
  240.   end if
  241.   if the doubleClick then
  242.     exit
  243.   end if
  244.   if draggingBottleThang() then
  245.     if pGlassType = #beer then
  246.       alertBeep()
  247.     else
  248.       pourIt(mGetReceiveSound(me))
  249.     end if
  250.   else
  251.     if draggingBottleOrSpoon() then
  252.     else
  253.       if sprite(barSlotToSprite(pMyBarSlot)).pDrinksBeenServed then
  254.         managerVO("I04")
  255.       else
  256.         if not draggingWellThang() and not draggingSpoon() then
  257.           if keyPressed(SPACE) then
  258.             exit
  259.           end if
  260.           pOrigLoc = pSpr.loc
  261.           mStoreOldContents(me)
  262.           sendSprite(gWellSprite, #mDragWellItem, pSpr, pSpr.member, VOID, pGlassType)
  263.           mHideDrink(me)
  264.         end if
  265.       end if
  266.     end if
  267.   end if
  268. end
  269.  
  270. on mStoreOldContents me
  271.   pOldContents = duplicate(pContents)
  272.   pOldIceAmount = pSpr.pGlassIce.pIceAmount
  273.   pOldGlassType = pGlassType
  274.   pOldMember = pSpr.member
  275. end
  276.  
  277. on mDropIt me
  278.   global gGlassDropWarning
  279.   if modifierDown() or (pGlassType = #beer) or not mIsHoldingLiquid(me) then
  280.     removeBarTopGlass(gBarTopManager, pMyBarSlot)
  281.   else
  282.     if mReplaceDrink(me) then
  283.       if not gGlassDropWarning then
  284.         remindAboutEmptyButton()
  285.         gGlassDropWarning = 1
  286.       end if
  287.     end if
  288.   end if
  289. end
  290.  
  291. on mDoneDragging me
  292.   newBarSlot = placeGlassOnBar(gWellSprite)
  293.   if newBarSlot[#closest] = 0 then
  294.     if (pGlassType = #beer) or modifierDown() or not mIsHoldingLiquid(me) then
  295.       removeBarTopGlass(gBarTopManager, pMyBarSlot)
  296.     else
  297.       if mReplaceDrink(me) then
  298.         remindAboutEmptyButton()
  299.       end if
  300.     end if
  301.   else
  302.     if newBarSlot[#closest] = pMyBarSlot then
  303.       status = newBarSlot[#status]
  304.       carded = newBarSlot[#carded]
  305.       if newBarSlot[#empty] = 1 then
  306.         managerVO("T05")
  307.       else
  308.         if status = #ordered then
  309.           remindToHitServe()
  310.         else
  311.           if status = #carded then
  312.             remindToTakeOrder()
  313.           else
  314.             if not carded then
  315.               remindAboutID()
  316.             end if
  317.           end if
  318.         end if
  319.       end if
  320.       mReplaceDrink(me)
  321.     else
  322.       if getBarTopGlass(gBarTopManager, newBarSlot[#closest]) <> #none then
  323.         alertBeep()
  324.         mReplaceDrink(me)
  325.       else
  326.         if sprite(barSlotToSprite(pMyBarSlot)).pDrinksBeenServed then
  327.           if mReplaceDrink(me) then
  328.             chillYouveServedDrink()
  329.           end if
  330.         else
  331.           oldSlot = pMyBarSlot
  332.           newSlot = newBarSlot[#closest]
  333.           setBarTopGlass(gBarTopManager, newSlot, pOldMember, pOldGlassType, 0, pOldContents, VOID, pOldIceAmount)
  334.           removeBarTopGlass(gBarTopManager, oldSlot)
  335.         end if
  336.       end if
  337.     end if
  338.   end if
  339.   soundFX("mGlass_on_bartop", 0, 0)
  340. end
  341.  
  342. on mReplaceDrink me
  343.   global gBarTopManager
  344.   if barSpotIsFree(gBarTopManager, pMyBarSlot) then
  345.     removeBarTopGlass(gBarTopManager, pMyBarSlot)
  346.     return 0
  347.   else
  348.     pSpr.loc = pOrigLoc
  349.     mShowDrink(me)
  350.     return 1
  351.   end if
  352. end
  353.  
  354. on mStirred me
  355.   if countStirrableIngredients(pContents) > 1 then
  356.     pContents[#stir] = 1
  357.   end if
  358. end
  359.  
  360. on mFill me, ingredient, liquidColor
  361.   returnVal = fillVessel(me, ingredient, liquidColor)
  362.   return returnVal
  363. end
  364.